package com.powernode.controller;

import com.powernode.domain.SysUser;
import com.powernode.model.Result;
import com.powernode.service.SysUserService;
import com.powernode.utils.AuthUtils;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: mky
 * @date: 2024/7/9 17:37
 * @version: 1.0
 */
@RestController
@RequestMapping("/sys/user")
@Api(value = "用户模块")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;
    @GetMapping("/info")
    public Result<SysUser> loadUserInfo(){
        Long loginedUserId = AuthUtils.getLoginedUserId();
        SysUser user = sysUserService.getById(loginedUserId);
        return Result.success(user);
    }
}
